<template>
<el-dialog width="70%" top="60px" :visible.sync="visible" title="详情" :close-on-click-modal="false" :close-on-press-escape="false" @close="close()" :destroy-on-close="true" @opened="opened()">
    <el-form class="dialogInner" :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '140px' : '130px'" >
        <el-row>
            <el-col :span="8">
                <el-form-item label="企业名称" prop="name">
                    {{dataForm.name||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="企业编码" prop="code">
                    {{dataForm.code||'--'}}
                </el-form-item>
            </el-col>
             
              <el-col :span="8">
                <el-form-item label="所属区域" prop="areaCode">
                    {{dataForm.areaName||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="企业法人" prop="legalPerson">
                    {{dataForm.legalPerson||'--'}}
                </el-form-item>
            </el-col>
          
          
             <el-col :span="8">
                <el-form-item label="经营项目" prop="operateProject">
                     {{dataForm.operateProject||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="餐饮类型" prop="type">
                     {{$getDictLabel('food_type',dataForm.type)}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="营业时间" prop="operateTime">
                    {{dataForm.operateTime||'--'}}
                </el-form-item>
            </el-col>
              <el-col :span="8">
                <el-form-item label="实际经营人姓名" prop="operatorName">
                    {{dataForm.operatorName||'--'}}
                </el-form-item>
            </el-col>
             <el-col :span="8">
                <el-form-item label="实际经营人类型" prop="operatorType">
                    {{$getDictLabel('hotel_operator_type',dataForm.operatorType)}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="经营人单位名称" prop="operatorUnit">
                    {{dataForm.operatorUnit||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="统一社会信用代码" prop="creditCode">
                    {{dataForm.creditCode||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="派出所代码" prop="policeCode">
                    {{dataForm.policeCode||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="注册登记号" prop="registerNo">
                    {{dataForm.registerNo||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="产权人类型" prop="ownerType">
                    {{$getDictLabel('hotel_owner_type',dataForm.ownerType)}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="经营人证件类型" prop="operatorCardType">
                    {{$getDictLabel('hotel_operator_card_type',dataForm.operatorCardType)}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="经营人证件号" prop="operatorCard">
                    {{dataForm.operatorCard||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="联系人姓名" prop="linkName">
                     {{dataForm.linkName||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="联系人号码" prop="linkPhone">
                     {{dataForm.linkPhone||'--'}}
                </el-form-item>
            </el-col>
           
            <el-col :span="8">
                <el-form-item label="星级" prop="star">
                    {{dataForm.star||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="评分" prop="score">
                     {{dataForm.score||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="最低价（人均）" prop="minPrice">
                    {{dataForm.minPrice||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="经度" prop="longitude">
                    {{dataForm.longitude||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="纬度" prop="latitude">
                    {{dataForm.latitude||'--'}}
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="营业时间范围" prop="">
                    {{dataForm.operateTimeRange||'--'}}
                </el-form-item>
            </el-col>
             <el-col :span="24">
                <el-form-item label="所在地址" prop="">
                    {{dataForm.provinceName}}-{{dataForm.cityName}}-{{dataForm.areaCodeName}}-{{dataForm.street}}-{{dataForm.areaDetail}}
                </el-form-item>
            </el-col>
            <el-col :span="24">
                <el-form-item label="图片" prop="">
                    <el-image :preview-src-list="dataForm.coverImageList" :src="item" v-for="(item,index) in dataForm.coverImageList" :key="index" class="showImg"></el-image>
                </el-form-item>
            </el-col>
        </el-row>
    </el-form>
</el-dialog>
</template>

<script>
import Cookies from "js-cookie";
import debounce from "lodash/debounce";
import mixinRegionModule from "@/mixins/region-module";
import mapdiv from "../map-data/map";
export default {
    mixins: [mixinRegionModule],

    data() {
        return {
            activeName: 'first',
            visible: false,
            scenicOptions: [],
            fileList: [],
            url: `${
        window.SITE_CONFIG["apiURL"]
      }/oss/file/aliyunUpload?access_token=${Cookies.get("access_token")}`,
            num: 0,
            dataForm: {
                id: "",
                fileList:[],
            },
        };
    },
    components: {
    },
    methods: {
        //景区数据list
        getScenicOptions() {
            this.$http.get("/scenic/isscenic/page", {}).then(({
                data: res
            }) => {
                if (res.msg == "success") {
                    this.scenicOptions = res.data.list;
                }
            });
        },
        opened() {
            this.provincAreaDetailInfoList();
            this.getScenicOptions();
            if (this.dataForm.city) {
                this.cityAreaDetailInfoList(this.dataForm.province);
            }
            if (this.dataForm.area) {
                this.countyAreaDetailInfoList(this.dataForm.city);
            }
        },
        close() {
            this.fileList = [];
            this.dataForm = {
                minPrice: '',
                score: '',
                areaCode: '',
                areaName: '',
                longitude: '',
                latitude: '',
                operateTimeRange: '',
                coverImageList: [],
                id: "",
                name: "",
                code: "",
                legalPerson: "",
                operatorType: "",
                operatorName: "",
                operatorUnit: "",
                creditCode: "",
                operatorCardType: "",
                policeCode: "",
                ownerType: "",
                operatorCard: "",
                registerNo: "",
                operateProject: "",
                operateTime: "",
                province: "",
                city: "",
                area: "",
                street: "",
                areaDetail: "",
                linkName: "",
                linkPhone: "",
                type: "",
                star: "",
                remark: "",
            };
            this.$emit("changeDisabled");
        },
        init() {
            this.visible = true;
            this.$nextTick(() => {
                this.$refs["dataForm"].resetFields();
                if (this.dataForm.id) {
                    this.getInfo();
                }
            });
        },
        // 获取信息
        getInfo() {
            this.$http
                .get("/sys/isfood/" + this.dataForm.id)
                .then(({
                    data: res
                }) => {
                    if (res.code !== 0) {
                        return this.$message.error(res.msg);
                    }
                    this.dataForm = {
                        ...this.dataForm,
                        ...res.data,
                    };
                    //时间范围
                    let operateTimeRange = this.dataForm.operateTimeRange.split('-');
                    // 图片处理
                    if (this.dataForm.coverImageList.length == 0) {
                        this.fileList = [];
                    } else if (this.dataForm.coverImageList) {
                        this.fileList = this.dataForm.coverImageList.map((item, index, arr) => {
                            let json = {};
                            json.name = "";
                            json.url = item;
                            return json;
                        });
                    }

                })
                .catch(() => {});
        },
    },
};
</script>
<style scope="scope">
.showImg{
    width:146px;
    height:146px;
    margin-right:10px;
}
</style>
